package com.example.onlinemonitoring.model.common;

import java.util.List;

public class MyResult<T> {
    public final static Integer SUCCESS = 0;//0：成功
    public final static Integer FALSE = 1;//1：失败
    public final static Integer ERROR = 2;//2：异常

    public float getRet() {
        return ret;
    }

    public void setRet(float ret) {
        this.ret = ret;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }

    public List<T> getData() {
        return data;
    }

    public void setData(List<T> data) {
        this.data = data;
    }

    public MyResult() {
        this.code = 0;
        this.msg = "default";
        this.count = 0;
    }

    public MyResult(boolean status) {
        if(status){
            this.code = 0;
            this.msg = "操作成功";
            this.count = 0;
        }else{
            this.code = 1;
            this.msg = "操作失败";
            this.count = 0;
        }
    }

    public MyResult(Integer restype,String description) {
        this.code = restype;
        this.msg = description;
        this.count = 0;
    }
    private float ret;
    private int code;//数据状态的字段名称，默认：code
    private String msg;//状态信息的字段名称，默认：msg
    private int count;//数据总数的字段名称，默认：count
    private List<T> data;//数据列表的字段名称，默认：data
}
